<!DOCTYPE html>
<html>
<% include ./head.html%>

<script type="text/javascript" src="/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/javascript/taccount.js"></script>


<script>

    var showTable = '<%= showTable %>';
    var showDetailInfo = '<%= showDetail %>';
    var account = '<%= account %>';
    showTable = showTable.split(",");
    showDetailInfo = showDetailInfo.split(",");

    console.log("showTable",showTable);
    console.log("showDetailInfo",showDetailInfo);

    $(function(){
        console.log(3333333)
        $("input[type=checkbox]").each(function(item){
            for(var i in showTable){
                console.log($(this).attr('value'))
                if($(this).attr('value') == showTable[i]){
                    $(this).attr("checked","true");
                }
            }
        })

    })

    var submitUserInfo = function(){
        console.log("保存");
        var showDetailInfotmp = [];
        var showTabletmp = [];
        var appidtemp = [];
        $("input[type=checkbox]:checked").each(function(){
            if($(this).attr('name') != 'appid') {
                if(showTabletmp.indexOf($(this).attr('value')) == -1){
                    showTabletmp.push($(this).attr('value'))
                }
                if(showDetailInfotmp.indexOf($(this).attr('name')) == -1){
                    showDetailInfotmp.push($(this).attr('name'))
                }
            }else{
                if(appidtemp.indexOf($(this).attr('value')) == -1){
                    appidtemp.push($(this).attr('value'))
                }
            }
        })
       var  power = JSON.stringify({showTable:showDetailInfotmp,showDetail:showTabletmp});
        var obj = {};
        obj.power = power;
        obj.userName = account;
        console.log("333333333333",obj)

        httpAjax('/controller/updateUser',obj,function(data){
            if(data.code == 200 ){
                alert("修改成功");
                history.go(-1);
            }else{
                alert("修改失败");
            }
        },function(){
            alert("修改失败");
        });
    }

</script>

<body class="top-navigation" style="min-width: 900px">

<div id="wrapper" style="">
    <div class="row border-bottom " style="background-color: #3b485b ;font-size:20px;height: 65px">
        <nav class="navbar navbar-static-top" style="background-color: #3b485b;margin-bottom: 0" role="navigation" >
            <div class="">

                <ul class="navbar-top-links minimalize-styl-2"  style="">
                    <li class="">
                        <a class="" style="background-color:#3b485b "  href="/boss/index">
                            <span style="font-size: 20px;color: white;font-family:YouYuan"  class="">孝道乐龄</span>
                        </a>
                    </li>
                </ul>
            </div>

            <ul class="nav navbar-top-links navbar-right">

                <li class="">
                    <a  style="background-color:#3b485b ">
                        <i class="fa fa-user-md" style="color: white;" ></i>
                        <span style="font-size: large;color: white" class=""><%= account %></span>
                    </a>
                </li>

                <li>
                    <a href="/logout" style="color: white;background-color:#3b485b ">
                        <!--   <i class="fa fa-sign-out"></i> 退出-->
                        <i class="" ></i> 退出
                    </a>
                </li>
            </ul>

        </nav>

    </div>
    <div id="page-wrapper" class="gray-bg dashbard-1">

        <div class="ibox-content">
            <form id="modifyUserInfo" class="form-horizontal">
                <div class="hr-line-dashed"></div>

                <div class="form-group">
                    <label class="col-lg-2 control-label">帐号</label>

                    <div class="col-lg-10">
                        <input type="text" id="NAME" disabled="" value='<%= account%> ' class="form-control">
                    </div>
                </div>



                <div class="hr-line-dashed"></div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"> 管理平台</label>
                    <div class="col-sm-10">
                        <label class="checkbox-inline"> <input name="situation" type="checkbox" value="indexInfo">首页</label>
                        <label class="checkbox-inline"> <input name="situation" type="checkbox" value="aboutAs">关于我们</label>
                        <label class="checkbox-inline"> <input name="situation" type="checkbox" value="company">企业文化</label>
                        <label class="checkbox-inline"> <input name="situation" type="checkbox" value="newsInfo">新闻动态</label>
                        <label class="checkbox-inline"> <input name="situation" type="checkbox" value="contact">联系我们</label>
                    </div>
                </div>

                <div class="hr-line-dashed"></div>

                <div class="form-group" id="userInfoShow" style="display: block">
                    <label class="col-sm-2 control-label">用户信息</label>
                    <div class="col-sm-10">
                        <label class="checkbox-inline">    <input name="userInfo" type="checkbox" value="UserList">后台管理帐号 </label>
                        <label class="checkbox-inline">    <input name="userInfo" type="checkbox" value="AddBossUser">添加后台管理帐号 </label>
                        <label class="checkbox-inline">    <input name="userInfo" type="checkbox" value="taccountApp">APP帐号信息 </label>
                    </div>
                </div>


                <div class="form-group" id="homehomehomehome" style="display: block">
                    <label class="col-sm-2 control-label">敬老院信息管理</label>
                    <div class="col-sm-10">
                        <label class="checkbox-inline">    <input name="home" type="checkbox" value="homeAccount">在院名单 </label>
                        <label class="checkbox-inline">    <input name="home" type="checkbox" value="nurse">护工列表 </label>
                        <label class="checkbox-inline">    <input name="home" type="checkbox" value="governor">管理员列表 </label>
                        <label class="checkbox-inline">    <input name="home" type="checkbox" value="AddUser">添加帐号 </label>
                        <label class="checkbox-inline">    <input name="home" type="checkbox" value="orderBusInfo">车辆预约信息 </label>
                        <label class="checkbox-inline">    <input name="home" type="checkbox" value="orderBusSet">车辆预约设置 </label>
                        <label class="checkbox-inline">    <input name="home" type="checkbox" value="noticeSet">车辆预约通知设置 </label>
                        <label class="checkbox-inline">    <input name="home" type="checkbox" value="pushInfo">信息推送 </label>
                        <label class="checkbox-inline">    <input name="home" type="checkbox" value="storyInfo">重阳故事 </label>
                        <label class="checkbox-inline">    <input name="home" type="checkbox" value="NewBorn">重阳新生 </label>

                    </div>
                </div>


                <div class="form-group" id="employee" style="display: block">
                    <label class="col-sm-2 control-label">敬老院信息管理</label>
                    <div class="col-sm-10">
                        <label class="checkbox-inline">    <input name="employee" type="checkbox" value="nurse">护工列表 </label>
                        <label class="checkbox-inline">    <input name="employee" type="checkbox" value="addNurse">添加员工 </label>
                        <label class="checkbox-inline">    <input name="employee" type="checkbox" value="governor">管理员列表 </label>
                    </div>
                </div>

                <div class="hr-line-dashed"></div>

                <div style="display: block" class="form-group">
                    <label class="col-sm-2 control-label">产品</label>
                    <div class="col-sm-10">
                        <label class="checkbox-inline">    <input name="appid" type="checkbox" checked="checked" value="0">孝道乐龄 </label>
                      
                    </div>
                </div>

                <div class="hr-line-dashed"></div>

                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-2" style="float: right">
                        <input class="btn btn-primary" type="button" onclick="submitUserInfo()" value="保存内容">
                    </div>
                </div>
            </form>
        </div>
        <div style="TEXT-ALIGN: center;margin:0 auto;;">
        </div>
    </div>
</div>

<!--统计代码，可删除-->

</body>

</html>
